import { DatePicker, Root } from 'native-base';

import React from 'react';
import { ActivityIndicator, Image, ImageBackground, Picker, ScrollView, Text, TextInput, View } from 'react-native';
// import { Icon } from 'react-native-elements';

// <View style={{ position: 'absolute', right: 0, top: 10, height: 30 }}>
// 	<Icon name="chevron-right" color="#999999" size={30}></Icon>
// </View>

export default function tpl(a: <T>(action: string, ...args: unknown[]) => ((...args: unknown[]) => void), s: (...class_names: string[]) => {}, d: (d: string) => string | unknown) {
	// 'headimg', 'teacher_name', 'sex', 'birthday', 'phone', 'mail_box'
	const arr0 = d('d') as { headimg: string, sex: string, teacher_name: string, birthday: string, phone: string, mail_box: string, brtime: string, sexing: string, imaging: string };
	if (arr0) {
		return (
			<Root>
				<View style={s('page')}>
					<ScrollView style={{ marginBottom: 50 }}>
						<View style={s('ht1')}>
							<Text style={s('textL')}>头像</Text>
							{(() => {
								if (arr0.headimg) {
									return (<Image source={{ uri: arr0.imaging }} style={s('tu1')} />);
								} else {
									return (<Image source={require('../../imgs/nan.jpg')} style={s('tu1')} />);
								}
							})()}
						</View>
						<View style={s('ht1')}>
							<Text style={s('textL')}>昵称</Text>
							<Text style={s('textR')}>{arr0.teacher_name}</Text>
						</View>
						<View style={s('ht1')}>
							<Text style={s('textL')}>性别</Text>
							<Text style={s('textR')} onPress={a('a002')}>{arr0.sexing}</Text>
							{// 	<Picker
								// 	selectedValue={arr0.sexing}
								// 	style={{ height: 50, width: 80 }}
								// 	onValueChange={a('a002', 'sex')}>
								// 	<Picker.Item label="男" value="男" />
								// 	<Picker.Item label="女" value="女" />
								// </Picker>
							}
						</View>
						<View style={s('ht1')}>
							<Text style={s('textL')}>生日</Text>

							<View style={{ flexDirection: 'row' }}>
								<Text style={s('textR4')}>{arr0.brtime}</Text>
								<View style={s('textR3')}>
									<ImageBackground source={require('../../imgs/rili.png')} style={s('im1')}>
										<DatePicker
											defaultDate={new Date(arr0.birthday)}
											// minimumDate={new Date(2018, 1, 1)}
											// maximumDate={new Date(2018, 12, 31)}
											locale={"en"}
											// timeZoneOffsetInMinutes={undefined}
											modalTransparent={false}
											animationType={"fade"}
											androidMode={"spinner"}
											// placeHolderText={arr0.brtime}
											textStyle={{ color: "#fff", opacity: 0 }}
											placeHolderTextStyle={{ color: "#fff", opacity: 0 }}
											disabled={false}
											onDateChange={a(('a003'))}
										/>
									</ImageBackground>
								</View>
							</View>
						</View>
						<View style={s('ht1')}>
							<Text style={s('textL')}>邮箱</Text>
							<TextInput style={s('textR5')} placeholder="请输入邮箱" onChangeText={a('a004')} value={arr0.mail_box} />
						</View>
						<View style={s('ht1')}>
							<Text style={s('textL')}>绑定手机号</Text>
							<Text style={s('textR')}>{arr0.phone}</Text>
						</View>
					</ScrollView>
					<View style={s('btn')}>
						<Text style={s('tbtn')} onPress={a('a005')}>保存</Text>
					</View>
				</View>
			</Root>);
	} else {
		return (
			<View style={s('footer1')}>
				<ActivityIndicator
					animating={true}
					color='blue'
					size="large"
				/>
			</View>);
	}
}
